let baseUrl = "https://2208.rjaaa.com"

function request(params) {

	return new Promise((resolve, reject) => {
		wx.request({
			...params,
			url: baseUrl + params.url,
			success: (res) => {
				if (res.data.code != 1) {
					wx.showToast({
						title: res.data.msg,
						icon: 'none',
						duration: 2000
					})
				}
				return resolve(res.data)
			},
			fail: (err) => {
				console.log(err)
				return reject(err)
			}
		})
	})
}
export default request